package staticmethod;

public class VerifyCodeUtil
{
    private VerifyCodeUtil()
    {

    }
    public static String getcode(int n)
    {
        String code = "";
        int i = 0;
        for(i = 0;i < n; i++)
        {
            int type = (int)(Math.random()*3);//[0,2]
            //大写 小写 数字
            switch(type)
            {
                case 0:
                    int num = (int)(Math.random()*10);
                    code = code +num;
                    break;
                case 1:
                    int big = (int)(Math.random()*26);
                    char ch = (char)(65 + big);
                    code = code + ch;
                    break;

                case 2:
                    int small = (int)(Math.random()*26);
                    char ch1 = (char)(97+small);
                    code+=ch1;
                    break;
            }

        }

        return code;
    }
}
